﻿using STHPMS1.DAL.D_Core;
using System.Data;
using ServiceStack.OrmLite;
using STHPMS1.ICore.I_Entity.Stmpms1;
using STHPMS1.Common.C_Entity.Stmpms1;
using STHPMS1.ICore.I_DAL.Repository;
using System.Collections.Generic;

namespace STHPMS1.DAL.D_Repository
{
    public class Df_Costmod_ParaRepository : DalBase, IDf_Costmod_ParaRepository
    {

        /// <summary>
        /// 获取资金模型名称
        /// </summary>
        /// <param name="annutype">分析类型</param>
        /// <returns></returns>
        public List<string> GetAnniName(string annutype)
        {
            
            IDbConnection conn = Adapter.OpenDbConnection();
            string strsql = "select distinct ANNI_NAME from dbo.DF_COSTMOD_PARA";
            if (annutype != null && annutype.Length>0)
            {
                strsql += " where ANNU_TYPE=" + annutype + "";
            }
            return conn.Column<string>(strsql);
        }

        /// <summary>
        /// 获取资金模型名称下所有分析年度
        /// </summary>
        /// <param name="anni_name"></param>
        /// <returns></returns>
        public List<string> GetAnaly_Year(string anni_name)
        {
            IDbConnection conn = Adapter.OpenDbConnection();
            string strsql = "select ANALY_YEAR from DF_COSTMOD_PARA where ANNI_NAME='" + anni_name + "' order by ANALY_YEAR";
            return conn.Column<string>(strsql);
        }
    }
}
